Ok, here's the deal; I'll explain it a little here, but you should really just do a search or read a tutorial.
A pointer is a (usually) 4 byte variable that holds a memory address. You can use the address operator, &, to obtain the address of a variable, and place that in the pointer. Now you can manipulate the variable THROUGH the pointer. For example:
Code:
int variable; //create an int, pretty standard ;)
int *ptrtoint; //create a pointer that is going to point to an int
ptrtoint=&variable; //assign address of variable to ptrtoint
*ptrtoint=5; //The dereference operator is the asterisk.
//What this does is sort of resolves the pointer so
//that you can read and write the value in the
//variable that it points to.
Now you may say, what's the point of using pointers, I can already access the variable directly. Pointers come in handy when you need to access a variable that was created by another part of your program, or the operating system. For example, if you want a function to be able to change a variable that you pass to it, you pass a pointer, so that the function knows where the variable is stored in memory. Ie:
Code:
void increment(int *var)
{
(*var)++; //(value pointed to by var)increment
//Note that parentheses are necessary for precedence reasons
}
void main() //uh oh, salem's gonna kill me
{
int a;
a=5;
increment(&a); //pass the address of the variable
cout << a << endl; //will display 6, not 5
}
If you were to pass a variable normally, by value, a copy of the variable would be created in the context of the function increment(), and any changes made to it would not effect the original variable.
Well, that's all I can explain right now, you should really get a tutorial. Start here:
http://newdata.box.sk/bx/c/index.htm
That's how I learnt everything I know.
Plus, I'm a really bad teacher, and it's about 40 degrees down here in aussie